package edu.biwu.request;

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;

@WebServlet("/req/demo01")
public class RequestDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println(request.getContextPath());///Day06_response_request,获取当前应用的AppLication Context
        System.out.println(request.getMethod());//获取的是请求方式
        System.out.println(request.getQueryString());//获取查询字符串，请求的是？后面的参数
        System.out.println(request.getRequestURI());//Day06_response_request/req/demo01
        System.out.println(request.getRequestURL());//http://localhost:8080/Day06_response_request/req/demo01
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
